#include "Light.h"
#include "Device.h"

using namespace Graphics;

Light::Light(void)
{
}

Light::~Light(void)
{
	Deinitialize();
}

void Light::Initialize()
{
	D3DDevice* device = GetPlatform()->GetDevice()->As<D3DDevice>();

	SetDiffuseColor(1.0f, 1.0f, 1.0f, 1.0f);

	SetDirection(0.0f, 0.0f, 1.0f);
}

void Light::Deinitialize()
{
}

void Light::SetDirection(float x, float y, float z)
{
	mDirection = D3DXVECTOR3(x, y, z);
}

void Light::SetDiffuseColor(float r, float g, float b, float a)
{
	mDiffuseColor = D3DXVECTOR4(r, g, b, a);
}

D3DXVECTOR4 Light::GetDiffuseColor()
{
	return mDiffuseColor;
}

D3DXVECTOR4 Light::GetAmbientColor()
{
	return mAmbientColor;
}

void Light::SetAmbientColor(float r, float g, float b, float a)
{
	mAmbientColor = D3DXVECTOR4(r, g, b, a);
}

void Light::SetSpecularPower(float power)
{
	mSpecularPower = power;
}

void Light::SetSpecularColor(float r, float g, float b, float a)
{
	mSpecularColor = D3DXVECTOR4(r, g, b, a);
}

LightBufferType Light::GetLightBufferInfo()
{
	LightBufferType info;
	info.AmbientColor	= mAmbientColor;
	info.DiffuseColor	= mDiffuseColor;
	info.Direction		= mDirection;
	info.SpecularColor	= mSpecularColor;
	info.SpecularPower	= mSpecularPower;
	return info;
}

D3DXVECTOR3 Light::GetDirection()
{
	return mDirection;
}